<?php
/**
 * Esta extensión nos permite trabajar con las ventanitas de CoolMessage de una forma sencilla y limpia.
 * j.m.j.s.
 * @package CWidget
 * @since 14/07/2009
 * @version 1.0
 */
class CoolMessage extends CWidget
{
	public $jQuery;

	public function run()
	{
		$this->registerClientScripts();
		$this->render('CoolMessage');
	}

  /**
   * Registers the clientside widget files (css & js)
   */
  private function registerClientScripts() 
  {
    // Get the resources path
    $resources = dirname(__FILE__).DIRECTORY_SEPARATOR.'resources';

    // publish the files
    $baseUrl = Yii::app()->assetManager->publish($resources);

    // register the files
    if($this->jQuery)
    	Yii::app()->clientScript->registerScriptFile($baseUrl.'/jquery.js');
    
    Yii::app()->clientScript->registerScriptFile($baseUrl.'/jquery.simplemodal.js');
    Yii::app()->clientScript->registerScriptFile($baseUrl.'/coolMessage.js');
    Yii::app()->clientScript->registerCssFile($baseUrl.'/coolMessage.css');
  }
}